﻿@using MealBooking.Core.Models.Accounts;
@model List<BalanceHistory>
@{
    Customer customer = ViewBag.Customer;
    var balanceHistories = Model;
    ViewBag.HeaderTitle = "Balance History";
    Layout = "../Shared/_Layout.cshtml";
}
<!--Navbar-->
<div data-role="navbar" data-iconpos="left">
    <div class="float-left">
        <div data-role="controlgroup" data-type="horizontal" data-inset="true" data-mini="true">
            <a href="@Url.Action("EditAccount", new { id = customer.Id })" data-role="button">Edit
                User</a> <a href="@Url.Action("EditCustomer", new { id = customer.Id })" data-role="button">
                    Edit Balance</a>
        </div>
    </div>
    @Html.Partial("_FloatRightPartial")
</div>
<!--Navbar End-->
<ul data-role="listview" data-inset="true" data-mini="true">
    <li data-role="list-divider">@customer.Name</li>
    @if (balanceHistories != null && balanceHistories.Count != 0)
    {
        <li>
            <div>
                <table>
                    <tr>
                        <th>
                            Old Balance
                        </th>
                        <th>
                            Type
                        </th>
                        <th>
                            Amount
                        </th>
                        <th>
                            New Balance
                        </th>
                        <th>
                            Operated By
                        </th>
                        <th>
                            Operated Time
                        </th>
                        <th>
                            Comment
                        </th>
                    </tr>
                    @foreach (var balanceHistory in balanceHistories)
                    {
                        <tr>
                            <td>@balanceHistory.OldBalance
                            </td>
                            <td>@balanceHistory.OperationType
                            </td>
                            <td>@balanceHistory.Amount
                            </td>
                            <td>@balanceHistory.NewBalance
                            </td>
                            <td>@balanceHistory.OperatedBy.Name
                            </td>
                            <td>@balanceHistory.OperatedTime
                            </td>
                            <td>@balanceHistory.Comment
                            </td>
                        </tr>
                    }
                </table>
            </div>
        </li>
    }
</ul>
